/*
 * Open LiveReplay Server - Live replay server for Supreme Commander
 * 
 * Copyright (C) 2009, 2009 Open LiveReplay Server Project
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details:
 * http://www.gnu.org/copyleft/lesser.html#TOC3
 */
package net.galacticwar.lua;

import java.util.ArrayList;

/**
 * A java interpretation of a LUA Table
 * 
 * @author Yoann Meste (aka Mancer)
 *
 */
public class LuaTable extends ArrayList<LuaPair>{
	private static final long serialVersionUID = -821122986513591646L;

	public Object getObject(String key) {
		for (LuaPair pair : this) {
			if (key.equals(pair.getKey())) {
				return pair.getValue();
			}

		}
		return null;
	}
	
	public Object getObject(int index) {
		return get(index).getValue();

	}

	
}
